import { useContext, useEffect, useState } from 'react'
import './App.css'
import { BrowserRouter as BRouter,Routes,Route} from "react-router-dom";
import '../node_modules/antd/dist/antd.css'

import {getToken, setToken} from './util/auth';
import {reqLogin} from './api/login'



function App() {
  const [count, setCount] = useState(0);
  useEffect(() => {

    // axios 会将传入的对象转换为 字符串；
    reqLogin({username:'admin',password:'123456'})
      .then(data => {
        const {token} = data;
        setToken(token);
      })
  })

  return (

    <Routes>
                <Route path='/' element={<Home />} />
                <Route path="/login" element={<Login />} />
    </Routes>
  )
}

export default App
